<!DOCTYPE html>
<html lang="en">

<head>
    <title>登录页面_风力发电</title>
    <meta charset="UTF-8" />
    <meta name="author" content="order by dede58.com" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <link rel="stylesheet" href="css/bootstrap.min.css" />
    <link rel="stylesheet" href="css/bootstrap-responsive.min.css" />
    <link rel="stylesheet" href="css/unicorn.login.css" />
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>

<body>
    <div id="logo">
        <h1 style="color: white; width: 600px;">风力发电站监控管理系统</h1>
    </div>
    <div id="loginbox">
        <div id="loginform" class="form-vertical"  />
        <p>输入用户名和密码继续.</p>
        <div class="control-group">
            <div class="controls">
                <div class="input-prepend">
                    <span class="add-on"><i class="icon-user"></i></span><input id="name" type="text" placeholder="用户名" />
                </div>
            </div>
        </div>
        <div class="control-group">
            <div class="controls">
                <div class="input-prepend">
                    <span class="add-on"><i class="icon-lock"></i></span><input id="password" type="password" placeholder="密码" />
                </div>
            </div>
        </div>
        <div class="form-actions">
            <span class="pull-right"><button onclick="dologin()" class="btn btn-inverse" > 登录</button></span>
        </div>
        </div>

        <div class="control-group">
            <div class="controls">
                <div class="input-prepend">
                    <span class="add-on"><i class="icon-envelope"></i></span><input type="text"
                        placeholder="E-mail address" />
                </div>
            </div>
        </div>
        <div class="form-actions">
            <span class="pull-left"><a href="#" class="flip-link" id="to-login">&lt; 返回登录</a></span>
            <span class="pull-right"><input type="submit" class="btn btn-inverse" value="Recover" /></span>
        </div>
        </form>
    </div>

    <script src="js/jquery.min.js"></script>
    <script src="js/unicorn.login.js"></script>
    <script>
        function dologin() {
            var data = {
                name:$("#name").val(),
                pass:$("#password").val()
            }
            $.ajax({
                type:"POST",
                url: "/login",
                contentType:'application/json',
                data:JSON.stringify(data),
                success: function (result) {

                    console.log(result)
                    if (result.code == 1) {
                        alert("登录成功！");
                        location.href="main.html"
                    } else {
                        alert("登录失败！");
                    }
                }
            });

        }
    </script>
</body>

</html>